package com.caseprocessing.model;

import java.util.List;

/**
 * 案卷文档数据模型
 * 对应解决方案中定义的结构化文档JSON格式
 */
public class CaseDocument {
    
    private String caseId;
    private int totalPages;
    private DocumentMetadata metadata;
    private List<Page> pages;
    
    public CaseDocument() {}
    
    public CaseDocument(String caseId, int totalPages) {
        this.caseId = caseId;
        this.totalPages = totalPages;
    }
    
    // Getters and Setters
    public String getCaseId() { return caseId; }
    public void setCaseId(String caseId) { this.caseId = caseId; }
    
    public int getTotalPages() { return totalPages; }
    public void setTotalPages(int totalPages) { this.totalPages = totalPages; }
    
    public DocumentMetadata getMetadata() { return metadata; }
    public void setMetadata(DocumentMetadata metadata) { this.metadata = metadata; }
    
    public List<Page> getPages() { return pages; }
    public void setPages(List<Page> pages) { this.pages = pages; }
    
    /**
     * 获取指定页码范围的页面
     */
    public List<Page> getPageRange(int startPage, int endPage) {
        return pages.subList(startPage - 1, endPage);
    }
    
    /**
     * 根据页面类型获取页面
     */
    public List<Page> getPagesByType(String pageType) {
        return pages.stream()
                .filter(page -> pageType.equals(page.getPageMetadata().getPageType()))
                .toList();
    }
}